﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Controls_ImageCropping : System.Web.UI.UserControl
{
    public string pathtosave { get; set; }
    public string pathtoload { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        hdfilepath.Value = KTFrameworkCus.Globals.ApplicationPath+"userupload/temp/";
    }

    public string imgUrl
    {
        get
        {
            return Image2.ImageUrl;
        }
    }

    protected void btnupload_Click(object sender, EventArgs e)
    {
        string path = pathtosave;
        string path1 = pathtoload;
        string strExtension = System.IO.Path.GetExtension(PhotoFile.FileName);
        string filename = DateTime.Now.Ticks.ToString() + strExtension;
        //string fullpath = HttpContext.Current.Request.PhysicalApplicationPath + path1 + filename;

        //btnupload.Text = filename;

        if (PhotoFile.HasFile)
        {
            PhotoFile.PostedFile.SaveAs(Server.MapPath(path + filename));
            //HiddenField1.Value = path + filename;
            Image1.ImageUrl = path1 + filename;

            Panel1.Visible = true;
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Upload.Visible = true;
    }
}